// $Id$
// Licensed under Apache License Version 2.0
// See: http://www.apache.org/licenses/LICENSE-2.0.html
package de.servicezombie.tcmdb;

import de.servicezombie.lang.ErrorCode;

public class TcmdbValidationFailedException extends TcmdbException {

	private static final long serialVersionUID = 1L;
	private Object validatedBean;
	
	public TcmdbValidationFailedException(String message, Throwable cause) {
		super(message, cause);
		setErrorCode(ErrorCode.ILLEGAL_ARGUMENT);
	}

	public TcmdbValidationFailedException(String message) {
		super(message);
		setErrorCode(ErrorCode.ILLEGAL_ARGUMENT);
	}
	
	public TcmdbValidationFailedException(Throwable cause) {
		super(cause);
		setErrorCode(ErrorCode.ILLEGAL_ARGUMENT);
	}
	
	public TcmdbValidationFailedException withValidatedBean(Object bean) {
		this.validatedBean = bean;
		return this;
	}

	@SuppressWarnings("unchecked")
	public <T> T getValidatedBean() {
		return (T) validatedBean;
	}
}
